home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / win / framer10.zip / GRABIT.ZIP / GRABIT2.BAS < prev    next >
BASIC Source File  |  1994-02-02  |  57KB  |  1,911 lines

  1. 'shared variables defined
  2.  
  3. Dim Shared selected$               'current object
  4. Dim Shared selectobjectmode%       'object select mode on/off
  5. Dim Shared objects$(12)            'objects in directory
  6. Dim Shared selectedred%            'object average red component
  7. Dim Shared selectedgreen%          'object average green component
  8. Dim Shared selectedblue%           'object average blue component
  9. Dim Shared colourchart(34, 3) As Integer 'colours to go ...
  10. Dim Shared colourinmode%           'we're selecting a colour
  11. Dim Shared frozen%                 'frozen yes/no
  12. Dim Shared penred%                 'pen average red component
  13. Dim Shared pengreen%               'pen average green component
  14. Dim Shared penblue%                'pen average blue component
  15. Dim Shared sizex%                  'object size x
  16. Dim Shared sizey%                  'object size y
  17. Dim Shared brush%                  'paintbrush size 0-2 ~ 1, 3, 5 pixel block
  18. Dim Shared picloaded%              'frozen & object loaded
  19. Dim Shared zoomx%                  'current zoom state for x: 100% = normal size
  20. Dim Shared zoomy%                  'current zoom state for y
  21. Dim Shared oldx%                   'where object was - only copyblock
  22. Dim Shared oldy%                   ' where necesary
  23. Dim Shared xpos%                   'doing a x pos calc
  24. Dim Shared coltest%                'for auto colour select
  25. Dim Shared colourbaron%            'colourbar only for ranges - not which=1
  26. Dim Shared w0%, w1%, w2%, w3%, r1%, r2%, r3%  'colour object change ranges
  27. Dim Shared w02%, w12%, w22%, w32%, r12%, r22%, r32%  'colour draw change ranges
  28. Dim Shared col1%, col2%            'for colour select screen
  29. Dim Shared pixelpatch%             'patch for stray pixel
  30. Dim Shared original%               'indicates original colour for object
  31. Dim Shared logo%                   'is the logo showing
  32. Dim Shared bodystatus%             'body draw state
  33. Dim Shared bodymovex%, bodymovey%  'body start co-ords
  34. Dim Shared bodyx2%, bodyy2%        'end co-ords
  35. Dim Shared b1%, b2%, b3%, b4%      'remove body block
  36. Dim Shared bbb1%, bbb2%, bbb3%, bbb4%      'for body OK
  37. Dim Shared bodydirection%          'which side of square
  38. Dim Shared linex%, liney%          'for paint line
  39. Dim Shared lastpicsaved%           'saved counter
  40. Dim Shared drawred%                'draw average red component
  41. Dim Shared drawgreen%              'draw average green component
  42. Dim Shared drawblue%               'draw average blue component
  43. Dim Shared picselect%              'awaiting pic select for store/print
  44. Dim Shared olderx%, oldery%        'old x&y sizes
  45. Dim Shared anychange%              'did a body change occur? (4 y/n)
  46. Dim Shared jump%                   '% for body increase/decrease
  47. Dim Shared bodyzoom%               'size of the current zoom
  48. Dim Shared onoff%, onoff3%, onoff4%, onoff5%'menus which are open
  49. Dim Shared oldmidx%, oldmidy%      'old v/hscroll1.values
  50. Dim Shared slide%                  'current slide showing
  51. Dim Shared area%(4801, 2)          'fading array of x,y co-ords
  52. Dim Shared delayslide%             'waiting for slide change
  53. Dim Shared slidetext$()            'text for slideshow
  54. Dim Shared currentslide%           'current slide
  55. Dim Shared slidestext%             'how many slides are there
  56. Dim Shared moveorgx%, moveorgy%    'old left,top pos before body
  57. Dim Shared viewdelay%              'the views delay flag = plz wait
  58. Dim Shared printstate%             'printstate%
  59. Dim Shared key0%                   'key 0 for background view
  60. Dim Shared zoomstep%               'zoom/body/move step size
  61. Dim Shared stepperbusy%            'busy changing step size
  62. Dim Shared greystate%              'greyscale is on
  63. Dim Shared z1%, z2%, z3%, z4%, z5%, z6%   'for greyscale at the zoom
  64. Dim Shared widthx%, widthy%        'for body
  65. Dim Shared m1%, m2%, m3%, m4%      'remove body block
  66.  
  67. Sub body ()
  68.   If Not viewdelay% And frozen% And selectobjectmode% = 0 And colourinmode% = 0 And bodystatus% = 0 And picselect% = 0 And picloaded% Then
  69.     bodystatus% = 1
  70.     grabit.MousePointer = 5
  71.   End If
  72. End Sub
  73.  
  74. Sub bodyend (abc%)
  75.   If abc% And anychange% Then   'Cancel
  76.     grabit.HScroll1.Value = oldmidx%
  77.     grabit.VScroll1.Value = oldmidy%
  78.     sizex% = olderx%
  79.     sizey% = oldery%
  80.     Call restorerle
  81.     Call copyblock(0, 0, 640, 480, 2, 1)
  82.     q% = maskimage(selected$, getxpos%(), getypos%(), 0, 3, 1)
  83.     Call copyblock(0, 0, 640, 480, 1, 0)
  84.   Else   'Ok
  85.     Call restorerle
  86.     Call storerle
  87.     Call copyblock(0, 0, sizex%, sizey%, 5, 3)
  88.     Call setactivepage(4)
  89.     If bodydirection = 1 Then
  90.       sizey% = yzoomblock(bbb1%, bbb2%, bbb3%, bbb4%, bodyzoom%, 0)
  91.     ElseIf bodydirection = 2 Then
  92.       sizey% = yzoomblock(bbb1%, bbb2%, bbb3%, bbb4%, bodyzoom%, 1)
  93.     ElseIf bodydirection = 3 Then
  94.       sizex% = xzoomblock(bbb1%, bbb2%, bbb3%, bbb4%, bodyzoom%, 0)
  95.     ElseIf bodydirection = 4 Then
  96.       sizex% = xzoomblock(bbb1%, bbb2%, bbb3%, bbb4%, bodyzoom%, 1)
  97.     End If
  98.   End If
  99.   grabit.bodyplus.Visible = False
  100.   grabit.Bodyminus.Visible = False
  101.   grabit.bodyok.Visible = False
  102.   grabit.bodynotok.Visible = False
  103.   grabit.Line (b1%, b2%)-(b3%, b4%), RGB(0, 128, 0), B
  104.   bodystatus% = 0
  105.   If grabit.registerBMP.Visible Then grabit.registerBMP.SetFocus
  106.   Call resetundo
  107.   oldx% = 0
  108.   oldy% = 0
  109. End Sub
  110.  
  111. Sub bodymove (direct%)
  112.   If bodystatus% = 4 And sizex% < 600 Then
  113.     grabit.MousePointer = 11
  114.     anychange% = True
  115.     testx% = getxpos%()
  116.     testy% = getypos%()
  117.     x1% = bodymovex%
  118.     x2% = bodyx2%
  119.     y1% = bodymovey%
  120.     y2% = bodyy2%
  121.     oldx% = sizex%
  122.     oldy% = sizey%
  123.     oldtestx% = testx%
  124.     oldtesty% = testy%
  125.     jump% = (zoomstep% * 2) + 1
  126.     If direct% = 1 Then
  127.       bodyzoom% = bodyzoom% + jump%
  128.     Else
  129.       bodyzoom% = bodyzoom% - jump%
  130.     End If
  131.     If bodyzoom% > 300 Then bodyzoom% = 300
  132.     If bodyzoom% < 0 Then bodyzoom% = 0
  133.     
  134.     Call restorerle
  135.     Call storerle
  136.     Call copyblock(0, 0, olderx%, oldery%, 3, 5)
  137.     Call setactivepage(5)
  138.     If bodydirection = 1 Then
  139.       sizey% = yzoomblock(bbb1%, bbb2%, bbb3%, bbb4%, bodyzoom%, 0)
  140.       grabit.Line (b1%, b2%)-(b3%, b4%), RGB(0, 128, 0), B
  141.       newysize% = round%(widthy% * (bodyzoom% / 100!))
  142.       b2% = m2% - (newysize% - widthy%)
  143.       grabit.Line (b1%, b2%)-(b3%, b4%), RGB(255, 0, 0), B
  144.       grabit.Refresh
  145.       grabit.VScroll1.Value = moveorgy% - (sizey% \ 2)
  146.       If sizey% \ 2 <> sizey% / 2 Then
  147.     grabit.VScroll1.Value = grabit.VScroll1.Value - 1
  148.       End If
  149.     ElseIf bodydirection = 2 Then
  150.       sizey% = yzoomblock(bbb1%, bbb2%, bbb3%, bbb4%, bodyzoom%, 1)
  151.       grabit.Line (b1%, b2%)-(b3%, b4%), RGB(0, 128, 0), B
  152.       newysize% = round%(widthy% * (bodyzoom% / 100!))
  153.       b4% = m4% + newysize% - widthy%
  154.       grabit.Line (b1%, b2%)-(b3%, b4%), RGB(255, 0, 0), B
  155.       grabit.Refresh
  156.       grabit.VScroll1.Value = moveorgy% + (sizey% \ 2)
  157.     ElseIf bodydirection = 3 Then
  158.       sizex% = xzoomblock(bbb1%, bbb2%, bbb3%, bbb4%, bodyzoom%, 0)
  159.       grabit.Line (b1%, b2%)-(b3%, b4%), RGB(0, 128, 0), B
  160.       newxsize% = round%(widthx% * (bodyzoom% / 100!))
  161.       If bodyzoom% > 100 Then
  162.     If newxsize% And 3 <> 0 Then newxsize% = newxsize% + (4 - (newxsize% And 3))
  163.       Else
  164.     If newxsize% And 3 <> 0 Then newxsize% = newxsize% - (newxsize% And 3)
  165.       End If
  166.       b1% = m1% - (newxsize% - widthx%)
  167.       grabit.Line (b1%, b2%)-(b3%, b4%), RGB(255, 0, 0), B
  168.       grabit.Refresh
  169.       grabit.HScroll1.Value = moveorgx% - (sizex% \ 2)
  170.       If moveorgx% > (CInt(((CInt(grabit.HScroll1.Value \ 4) * 4) - (sizex% \ 2)) \ 4) * 4) + sizex% Then
  171.     grabit.HScroll1.Value = grabit.HScroll1.Value + 4
  172.       ElseIf moveorgx% < (CInt(((CInt(grabit.HScroll1.Value \ 4) * 4) - (sizex% \ 2)) \ 4) * 4) + sizex% Then
  173.     grabit.HScroll1.Value = grabit.HScroll1.Value - 4
  174.       End If
  175.     ElseIf bodydirection = 4 Then
  176.       sizex% = xzoomblock(bbb1%, bbb2%, bbb3%, bbb4%, bodyzoom%, 1)
  177.       grabit.Line (b1%, b2%)-(b3%, b4%), RGB(0, 128, 0), B
  178.       newxsize% = round%(widthx% * (bodyzoom% / 100!))
  179.       If bodyzoom% > 100 Then
  180.     If newxsize% And 3 <> 0 Then newxsize% = newxsize% + (4 - (newxsize% And 3))
  181.       Else
  182.     If newxsize% And 3 <> 0 Then newxsize% = newxsize% - (newxsize% And 3)
  183.       End If
  184.       b3% = m3% + newxsize% - widthx%
  185.       grabit.Line (b1%, b2%)-(b3%, b4%), RGB(255, 0, 0), B
  186.       grabit.Refresh
  187.       grabit.HScroll1.Value = moveorgx% + (sizex% \ 2)
  188.       If moveorgx% > CInt(((CInt(grabit.HScroll1.Value \ 4) * 4) - (sizex% \ 2)) \ 4) * 4 Then
  189.     grabit.HScroll1.Value = grabit.HScroll1.Value + 4
  190.       ElseIf moveorgx% < CInt(((CInt(grabit.HScroll1.Value \ 4) * 4) - (sizex% \ 2)) \ 4) * 4 Then
  191.     grabit.HScroll1.Value = grabit.HScroll1.Value - 4
  192.       End If
  193.     End If
  194.     testx% = getxpos%()
  195.     testy% = getypos%()
  196.     If testx% < oldtestx% Then
  197.       qwer1% = testx%
  198.     Else
  199.       qwer1% = oldtestx%
  200.     End If
  201.     If testy% < oldtesty% Then
  202.       qwer2% = testy%
  203.     Else
  204.       qwer2% = oldtesty%
  205.     End If
  206.     If sizex% > oldx% Then
  207.       qwer3% = sizex%
  208.     Else
  209.       qwer3% = oldx%
  210.     End If
  211.     If sizey% > oldy% Then
  212.       qwer4% = sizey%
  213.     Else
  214.       qwer4% = oldy%
  215.     End If
  216.     Call copyblock(qwer1%, qwer2%, qwer1% + qwer3%, qwer2% + qwer4%, 2, 1)
  217.     q% = maskimage(selected$, getxpos%(), getypos%(), 0, 5, 1)
  218.     Call copyblock(qwer1%, qwer2%, qwer1% + qwer3%, qwer2% + qwer4%, 1, 0)
  219.     grabit.MousePointer = 0
  220.   End If
  221. End Sub
  222.  
  223. Sub brushcolourdraw ()
  224.   grabit.Picture1.FillColor = RGB(drawred%, drawgreen%, drawblue%)
  225.   grabit.Picture1.Cls
  226.   Select Case brush%
  227.   Case 0
  228.     grabit.Picture1.Circle (7, 7), 2
  229.   Case 1
  230.     grabit.Picture1.Circle (7, 7), 4
  231.   Case 2
  232.     grabit.Picture1.Circle (7, 7), 6
  233.   End Select
  234. End Sub
  235.  
  236. Sub brushsize ()
  237.   grabit.Picture1.Cls
  238.   brush% = brush% + 1
  239.   If brush% = 3 Then brush% = 0
  240.   Select Case brush%
  241.   Case 0
  242.     Call setbrushsize(3)
  243.     grabit.Picture1.Circle (7, 7), 2
  244.   Case 1
  245.     Call setbrushsize(5)
  246.     grabit.Picture1.Circle (7, 7), 4
  247.   Case 2
  248.     Call setbrushsize(8)
  249.     grabit.Picture1.Circle (7, 7), 6
  250.   End Select
  251. End Sub
  252.  
  253. Sub chartcolour (x, y)
  254.   p% = 124 + ((x / 100) * 480)
  255.   If y <= 36 Then
  256.     ttt% = grabit.HScroll6.Value
  257.     Call setupcolourbarindicators(p%, ttt%)
  258.     grabit.HScroll5.Value = p%
  259.   Else
  260.     ttt% = grabit.HScroll5.Value
  261.     Call setupcolourbarindicators(ttt%, p%)
  262.     grabit.HScroll6.Value = p%
  263.   End If
  264. End Sub
  265.  
  266. Sub colourbar ()
  267.   If colourbaron% Then
  268.     colourinmode% = 2
  269.     vtemp% = grabit.HScroll5.Value
  270.     If greystate% Then
  271.       Call colourmixdo(vtemp%)
  272.       greystate% = True
  273.     Else
  274.       Call colourmixdo(vtemp%)
  275.     End If
  276.     Call drawbar
  277.     If grabit.registerBMP.Visible Then grabit.registerBMP.SetFocus
  278.   End If
  279. End Sub
  280.  
  281. Sub colourbarcopyaround ()
  282.   Call copyblock(0, 0, 640, 2, 1, 0)      'top of bar
  283.   Call copyblock(0, 0, 92, 34, 1, 0)      'left of bar
  284.   Call copyblock(638, 0, 2, 34, 1, 0)     'right
  285.   Call copyblock(0, 34, 640, 462, 1, 0)   'below
  286. End Sub
  287.  
  288. Sub colourbarnew (page%)
  289.   Call setactivepage(page%)
  290.   For x% = 76 To 168 Step 4
  291.     p@ = (x% - 76) / 100
  292.     c1% = w1% + (r1% * p@)
  293.     c2% = w2% + (r2% * p@)
  294.     c3% = w3% + (r3% * p@)
  295.     Call blockrgb(x%, 225, 4, 35, c1%, c2%, c3%)
  296.     c1% = w12% + (r12% * p@)
  297.     c2% = w22% + (r22% * p@)
  298.     c3% = w32% + (r32% * p@)
  299.     Call blockrgb(x%, 260, 4, 35, c1%, c2%, c3%)
  300.   Next x%
  301. End Sub
  302.  
  303. Sub colourbarshow ()
  304.   Call setactivepage(0)
  305.   For x% = 92 To 620 Step 4
  306.     p@ = (x% - 92) / 528
  307.     c1% = w1% + (r1% * p@)
  308.     c2% = w2% + (r2% * p@)
  309.     c3% = w3% + (r3% * p@)
  310.     Call blockrgb(x%, 2, 4, 16, c1%, c2%, c3%)
  311.     c1% = w12% + (r12% * p@)
  312.     c2% = w22% + (r22% * p@)
  313.     c3% = w32% + (r32% * p@)
  314.     Call blockrgb(x%, 18, 4, 16, c1%, c2%, c3%)
  315.   Next x%
  316. End Sub
  317.  
  318. Sub colourmix (topornot%)
  319.   If Not viewdelay% And frozen% And selectobjectmode% = False And picloaded% And colourinmode% = False And picselect% = 0 And bodystatus% = 0 Then
  320.     grabit.MousePointer = 11
  321.     scrollgone (2)
  322.     Call setactivepage(1)
  323.     Call clearpage(1)
  324.     tmp% = 1
  325.     Open selected$ + "-2.mmp" For Binary As #1
  326.     dum$ = "  "
  327.     Get #1, 13, dum$
  328.     sx% = (Asc(Right$(dum$, 1)) * 256 + Asc(Left$(dum$, 1)))
  329.     Get #1, 15, dum$
  330.     sy% = (Asc(Right$(dum$, 1)) * 256 + Asc(Left$(dum$, 1)))
  331.     Close
  332.     yspot% = (480 - (sy% * 4)) \ 2
  333.     col1% = yspot%
  334.     col2% = sy%
  335.     z% = 2
  336.     For y% = 0 To 3
  337.       For x% = 0 To 3
  338.     Open selected$ + ".rgb" For Input As #1
  339.     Line Input #1, tr$
  340.     Line Input #1, tg$
  341.     Line Input #1, tb$
  342.     Close 1
  343.     wow1% = (colourchart(z%, 1) + colourchart(z% - 1, 1)) \ 2
  344.     wow2% = (colourchart(z%, 2) + colourchart(z% - 1, 2)) \ 2
  345.     wow3% = (colourchart(z%, 3) + colourchart(z% - 1, 3)) \ 2
  346.     newr% = 100 + (wow1% - Val(tr$)) / Val(tr$) * 100
  347.     newg% = 100 + (wow2% - Val(tg$)) / Val(tg$) * 100
  348.     newb% = 100 + (wow3% - Val(tb$)) / Val(tb$) * 100
  349.     q% = colmiximage(selected$ + "-2", x% * 140 + 80, yspot%, tmp%, 1, Val(tr$), Val(tg$), Val(tb$), newr%, newg%, newb%)
  350.     tmp% = 0
  351.     z% = z% + 2
  352.       Next x%
  353.       yspot% = yspot% + sy%
  354.     Next y%
  355.     Call copyblock(0, 0, 640, 480, 1, 0)
  356.     Call setactivepage(0)
  357.     colourinmode% = topornot%
  358.     grabit.MousePointer = 0
  359.   End If
  360. End Sub
  361.  
  362. Sub colourmixdo (which%)
  363.   If Not viewdelay% And frozen% And colourinmode% = 1 And selectobjectmode% = False And picselect% = 0 And bodystatus% = 0 Then
  364.     q% = pcv_clearvideorect(0, 0, 641, 480)
  365.     If which% = 1 Then
  366.       colourinmode% = 2
  367.       GoTo test
  368.     End If
  369.     w0% = (which% - 2) * 2 + 1
  370.     If colourchart(w0%, 1) < colourchart(w0% + 1, 1) Then
  371.       w1% = colourchart(w0%, 1)
  372.     Else
  373.       w1% = colourchart(w0% + 1, 1)
  374.     End If
  375.     If colourchart(w0%, 2) < colourchart(w0% + 1, 2) Then
  376.       w2% = colourchart(w0%, 2)
  377.     Else
  378.       w2% = colourchart(w0% + 1, 2)
  379.     End If
  380.     If colourchart(w0%, 3) < colourchart(w0% + 1, 3) Then
  381.       w3% = colourchart(w0%, 3)
  382.     Else
  383.       w3% = colourchart(w0% + 1, 3)
  384.     End If
  385.     r1% = Abs(colourchart(w0%, 1) - colourchart(w0% + 1, 1))
  386.     r2% = Abs(colourchart(w0%, 2) - colourchart(w0% + 1, 2))
  387.     r3% = Abs(colourchart(w0%, 3) - colourchart(w0% + 1, 3))
  388.     w02% = w0%
  389.     w12% = w1%
  390.     w22% = w2%
  391.     w32% = w3%
  392.     r12% = r1%
  393.     r22% = r2%
  394.     r32% = r3%
  395.     colourinmode% = 2
  396.     which% = 360
  397.   End If
  398. test:
  399.   If frozen% And colourinmode% = 2 And selectobjectmode% = False Then
  400.     grabit.MousePointer = 11
  401.     If which% = 1 Then
  402.       newr% = 100
  403.       newg% = 100
  404.       newb% = 100
  405.       penred% = selectedred%
  406.       pengreen% = selectedgreen%
  407.       penblue% = selectedblue%
  408.       original% = -1
  409.       drawred% = selectedred%
  410.       drawgreen% = selectedgreen%
  411.       drawblue% = selectedblue%
  412.     Else
  413.       p@ = (which% - 92) / 528
  414.       c1% = w1% + (r1% * p@)
  415.       c2% = w2% + (r2% * p@)
  416.       c3% = w3% + (r3% * p@)
  417.       newr% = 100 + (c1% - selectedred%) / selectedred% * 100
  418.       newg% = 100 + (c2% - selectedgreen%) / selectedgreen% * 100
  419.       newb% = 100 + (c3% - selectedblue%) / selectedblue% * 100
  420.       penred% = c1%
  421.       pengreen% = c2%
  422.       penblue% = c3%
  423.       original% = 0
  424.       drawred% = penred%
  425.       drawgreen% = pengreen%
  426.       drawblue% = penblue%
  427.     End If
  428.     
  429.     If coltest% <> 0 Then
  430.       Call copyblock(0, 0, 640, 480, 2, 1)
  431.       Call copyblock(0, 0, sizex%, sizey%, 4, 3)
  432.     End If
  433.     
  434.     Call setactivepage(3)
  435.     If which% <> 1 Then
  436.       Call colourchange(selectedred%, selectedgreen%, selectedblue%, newr%, newg%, newb%)
  437.       z1% = selectedred%
  438.       z2% = selectedgreen%
  439.       z3% = selectedblue%
  440.       z4% = newr%
  441.       z5% = newg%
  442.       z6% = newb%
  443.     End If
  444.     q% = maskimage(selected$, getxpos%(), getypos%(), 0, 3, 1)
  445.     If onoff3% And colourbaron% Then Call colourbarnew(1)
  446.     If which% <> 1 Then
  447.       If grabit.HScroll5.Value <> which% Then
  448.     grabit.HScroll5.Value = which%
  449.     grabit.HScroll6.Value = which%
  450.       End If
  451.       colourbaron% = True
  452.       Call copyblock(0, 0, 640, 480, 1, 0)
  453.     Else
  454.       colourbaron% = False
  455.       Call copyblock(0, 0, 640, 480, 1, 0)
  456.     End If
  457.     brushcolourdraw
  458.     scrollhere
  459.     colourinmode% = False
  460.     grabit.MousePointer = 0
  461.     pixelpatch% = 0
  462.     drawbar
  463.     greystate% = False
  464.     Call resetundo
  465.   End If
  466.   If grabit.registerBMP.Visible Then grabit.registerBMP.SetFocus
  467. End Sub
  468.  
  469. Sub drawbar ()
  470.   p@ = (grabit.HScroll6.Value - 92) / 528
  471.   If colourbaron% Then
  472.     drawred% = w12% + (r12% * p@)
  473.     drawgreen% = w22% + (r22% * p@)
  474.     drawblue% = w32% + (r32% * p@)
  475.     p2@ = (grabit.HScroll5.Value - 92) / 528
  476.     drawred2% = w1% + (r1% * p@)
  477.     drawgreen2% = w2% + (r2% * p@)
  478.     drawblue2% = w3% + (r3% * p@)
  479.     drawred2% = drawred% * ((100 + (selectedred% - drawred2%) / drawred2% * 100) / 100)
  480.     drawgreen2% = drawgreen% * ((100 + (selectedgreen% - drawgreen2%) / drawgreen2% * 100) / 100)
  481.     drawblue2% = drawblue% * ((100 + (selectedblue% - drawblue2%) / drawblue2% * 100) / 100)
  482.   End If
  483.   Call initcolours(drawred%, drawgreen%, drawblue%)
  484.   Call defcolours(drawred2%, drawgreen2%, drawblue2%)
  485.   brushcolourdraw
  486.   If grabit.registerBMP.Visible Then grabit.registerBMP.SetFocus
  487. End Sub
  488.  
  489. Sub ending ()
  490.   freememory
  491.   q% = pcv_disablevideo()
  492.   q% = pcv_exit()
  493.   End
  494. End Sub
  495.  
  496. Sub freeze ()
  497.   frozen% = True
  498.   penred% = 137
  499.   pengreen% = 117
  500.   penblue% = 86
  501.   zoomx% = 0
  502.   zoomy% = 0
  503.   colourbaron% = 0
  504.   original% = -1
  505.   sizex% = 0
  506.   sizey% = 0
  507.   q% = pcv_freezevideo()
  508.   Call copyblock(0, 0, 640, 480, 0, 2)
  509. End Sub
  510.  
  511. Sub freezetoggle ()
  512.   If bodystatus% = 0 Then
  513.     If frozen% = False Then
  514.       freeze
  515.       target (0)
  516.       Call resetundo
  517.     Else
  518.       unfreeze
  519.       scrollgone (1)
  520.       colourinmode% = False
  521.       selectobjectmode% = False
  522.       picselect% = False
  523.       target (12)
  524.     End If
  525.   End If
  526. End Sub
  527.  
  528. Sub freezetogglepre ()
  529.   Call freezetoggle
  530.   If frozen% Then Call views(1)
  531. End Sub
  532.  
  533. Function getxpos% ()
  534.   
  535.   'used to use scroll-bars
  536.   
  537.   xpos% = True
  538.   xtemp% = grabit.HScroll1.Value
  539.   If grabit.HScroll1.Value < (sizex% \ 2) + 8 Then xtemp% = (sizex% \ 2) + 8
  540.   If grabit.HScroll1.Value > 639 - (sizex% \ 2) Then xtemp% = 639 - (sizex% \ 2)
  541.   grabit.HScroll1.Value = CInt(xtemp% \ 4) * 4
  542.   getxpos% = CInt((grabit.HScroll1.Value - (sizex% \ 2)) \ 4) * 4
  543.   xpos% = False
  544. End Function
  545.  
  546. Function getypos% ()
  547.   
  548.   'used to use scroll-bars
  549.   
  550.   xpos% = True
  551.   getypos% = grabit.VScroll1.Value - (sizey% \ 2)
  552.   xpos% = False
  553. End Function
  554.  
  555. Sub greyscaledo ()
  556.   If Not greystate% And Not viewdelay% And frozen% And selectobjectmode% = 0 And picloaded% And colourinmode% = False And picselect% = 0 And bodystatus% = 0 Then
  557.     grabit.MousePointer = 11
  558.     setactivepage (3)
  559.     Call greyscale
  560.     Call copyblock(0, 0, sizex%, sizey%, 3, 4)
  561.     scrollaround
  562.     w1% = colourchart%(33, 1)
  563.     w2% = colourchart%(33, 2)
  564.     w3% = colourchart%(33, 3)
  565.     r1% = colourchart(34, 1) - colourchart(33, 1)
  566.     r2% = colourchart(34, 2) - colourchart(33, 2)
  567.     r3% = colourchart(34, 3) - colourchart(33, 3)
  568.     w12% = w1%
  569.     w22% = w2%
  570.     w32% = w3%
  571.     r12% = r1%
  572.     r22% = r2%
  573.     r32% = r3%
  574.     colourbaron% = True
  575.     Call copyblock(0, 0, 640, 480, 1, 0)
  576.     brushcolourdraw
  577.     scrollhere
  578.     colourinmode% = False
  579.     pixelpatch% = 0
  580.     drawbar
  581.     c1% = w1% + (r1% * .5)
  582.     c2% = w2% + (r2% * .5)
  583.     c3% = w3% + (r3% * .5)
  584.     penred% = c1%
  585.     pengreen% = c2%
  586.     penblue% = c3%
  587.     original% = 0
  588.     drawred% = penred%
  589.     drawgreen% = pengreen%
  590.     drawblue% = penblue%
  591.     selectedred% = penred%
  592.     selectedgreen% = pengreen%
  593.     selectedblue% = penblue%
  594.     greystate% = True
  595.     grabit.MousePointer = 0
  596.   End If
  597. End Sub
  598.  
  599. Sub initializegrabit ()
  600.   
  601.   'called when form is loaded
  602.   
  603.   'maximize window, display it
  604.   grabit.WindowState = 2
  605.   grabit.Show
  606.   grabit.Refresh
  607.  
  608.   'the GRABIT working directory
  609.   ChDir "\windows\grabit"
  610.   
  611.   'standard PC-Video initialization for full-screen video
  612.   q% = pcv_loadconfiguration()
  613.   q% = pcv_initialize()
  614.   If q% = 0 Then
  615.     q% = MsgBox("The video capture adaptor was NOT found.", 48, "I have a problem !")
  616.     End
  617.   End If
  618.   q% = pcv_setcolorkey(2)
  619.   q% = pcv_createwindow(0, 0, 640, 480, 1)
  620.   q% = pcv_setwindowsize(640, 480, 0)
  621.   q% = pcv_setwindowposition(0, 0)
  622.   q% = pcv_setvideosource(0)
  623.   q% = pcv_enablevideo()
  624.   q% = pcv_freezevideo()
  625.   q% = pcv_clearvideorect(0, 0, 641, 480)
  626.   q% = pcv_unfreezevideo()
  627.   
  628.   'ask user for which framegrabber is installed
  629.   'the call to INITDLL needs to be told which card is installed
  630.   card% = MsgBox("Select YES for" + Chr$(10) + Chr$(10) + "PE-Von PV100" + Chr$(10) + "Adda Aver 2000" + Chr$(10) + "Aitech Pro PC-Video" + Chr$(10) + Chr$(10) + Chr$(10) + "Select NO for" + Chr$(10) + Chr$(10) + "Creative Labs VideoBlaster", 3, "Which framegrabber do you have installed ?")
  631.   If card% <> 6 And card% <> 7 Then
  632.     q% = MsgBox("You cancelled - ending program.", 0, "The End")
  633.     End
  634.   End If
  635.   
  636.   grabit.MousePointer = 11
  637.  
  638.   '1st parameter inidicates number of extra pages to allocate (768K each)
  639.   'minimum of one page must be allocated
  640.   '2nd parameter indicates card type: 0 = PE-Von PV100, Adda Aver 2000, Aitech Pro PC-Video
  641.   '                                   1 = Creative Labs VideoBlaster
  642.   'note we are asking for 5 extra pages which is about 4MB so you better have
  643.   '8MB installed or you'll wait forever ...
  644.   Call initdll(5, card% - 6)
  645.   Call setactivepage(0)
  646.   
  647.   'default object
  648.   selected$ = "obj01"
  649.   selectobjectmode% = False
  650.   Open "obj01.rgb" For Input As #1
  651.   Input #1, selectedred%
  652.   Input #1, selectedgreen%
  653.   Input #1, selectedblue%
  654.   Close
  655.   
  656.   'load the colour chart values
  657.   Open "colormap" For Input As #1
  658.   For q% = 1 To 32
  659.     Input #1, colourchart%(q%, 1)
  660.     Input #1, colourchart%(q%, 2)
  661.     Input #1, colourchart%(q%, 3)
  662.     Input #1, dummy%
  663.   Next q%
  664.   Close
  665.   colourchart%(33, 1) = 50
  666.   colourchart%(33, 2) = 50
  667.   colourchart%(33, 3) = 50
  668.   colourchart%(34, 1) = 200
  669.   colourchart%(34, 2) = 200
  670.   colourchart%(34, 3) = 200
  671.  
  672.   brushsize
  673.   original% = -1
  674.   
  675.   target (12)
  676.   
  677.   Call resetundo
  678.   
  679.   'load the slide-show random fading co-ordinates
  680.   Open "fader" For Input As #123
  681.   For q% = 1 To 4800
  682.     Line Input #123, l$
  683.     area%(q%, 1) = Val(l$)
  684.     Line Input #123, l$
  685.     area%(q%, 2) = Val(l$)
  686.     Line Input #123, l$
  687.   Next q%
  688.   Close 123
  689.   
  690.   'load the slide-show 'macro'
  691.   ReDim Preserve slidetext$(50, 8)
  692.   Open "slidetxt" For Input As #123
  693.   foundthestart% = False
  694.   Do Until EOF(123)
  695.     If Not foundthestart% Then Line Input #123, l$
  696.     If l$ = "BEGIN" Then foundthestart% = True
  697.     If foundthestart% Then
  698.       slidestext% = slidestext% + 1
  699.       For q% = 1 To 8
  700.     Line Input #123, l$
  701.     slidetext$(slidestext%, q%) = LTrim$(RTrim$(l$))
  702.       Next q%
  703.       If Not EOF(123) Then Line Input #123, l$
  704.     End If
  705.   Loop
  706.   Close 123
  707.   
  708.   zoomstep% = 3
  709.   grabit.stepsize.Value = zoomstep%
  710.  
  711.   grabit.initmess.Visible = False
  712.  
  713.   grabit.MousePointer = 0
  714. End Sub
  715.  
  716. Sub keyboardhandler (xyz%)
  717.   
  718.   'the scroll-bar via the FX icon can be adjusted via the keypad as well
  719.   
  720.   If Not stepperbusy% Then
  721.     stepperbusy% = True
  722.     Select Case xyz%
  723.     Case 96, 45   '0
  724.       If Not viewdelay% And frozen% And selectobjectmode% = False And picloaded% And colourinmode% = False And picselect% = 0 And bodystatus% = 0 Then
  725.     Call copyblock(0, 0, 640, 480, 2, 0)
  726.     Call printvideo
  727.     key0% = True
  728.       End If
  729.     Case -1, 97, 35  '1
  730.       zoomstep% = 1
  731.     Case -2, 98, 40  '2
  732.       zoomstep% = 2
  733.     Case -3, 99, 34  '3
  734.       zoomstep% = 3
  735.     Case -4, 100, 37  '4
  736.       zoomstep% = 4
  737.     Case -5, 101, 12  '5
  738.       zoomstep% = 5
  739.     Case -6, 102, 39  '6
  740.       zoomstep% = 6
  741.     Case -7, 103, 36  '7
  742.       zoomstep% = 7
  743.     Case -8, 104, 38  '8
  744.       zoomstep% = 8
  745.     Case -9, 105, 33  '9
  746.       zoomstep% = 9
  747.     End Select
  748.     If xyz% > 0 Then
  749.       grabit.stepsize.Value = zoomstep%
  750.     End If
  751.     stepperbusy% = False
  752.   End If
  753.   If grabit.registerBMP.Visible Then grabit.registerBMP.SetFocus
  754. End Sub
  755.  
  756. Sub loadpic ()
  757.   If Not viewdelay% And frozen% And selectobjectmode% = False And picloaded% And colourinmode% = False And picselect% = 0 And bodystatus% = 0 Then
  758.     grabit.MousePointer = 11
  759.     Call noicons
  760.     picselect% = True
  761.     Call setactivepage(0)
  762.     q% = savemmp("temp.mmp", 0, 0, 640, 480)
  763.     Call clearpage(0)
  764.     Call blockrgb(0, 237, 628, 4, 200, 200, 200)
  765.     Call blockrgb(312, 0, 4, 480, 200, 200, 200)
  766.     q% = shrinkimage("store0.mmp", 0, 0, 49)
  767.     q% = shrinkimage("store1.mmp", 316, 0, 49)
  768.     q% = shrinkimage("store2.mmp", 0, 240, 49)
  769.     q% = shrinkimage("store3.mmp", 316, 240, 49)
  770.     grabit.MousePointer = 0
  771.   End If
  772. End Sub
  773.  
  774. Sub loadpicshow (x, y)
  775.   logo% = -1
  776.   Call printvideo
  777.   If x < 316 Then
  778.     If y < 240 Then
  779.       q% = loadmmp("store0.mmp", 0, 0)
  780.     Else
  781.       q% = loadmmp("store2.mmp", 0, 0)
  782.     End If
  783.   Else
  784.     If y < 240 Then
  785.       q% = loadmmp("store1.mmp", 0, 0)
  786.     Else
  787.       q% = loadmmp("store3.mmp", 0, 0)
  788.     End If
  789.   End If
  790. End Sub
  791.  
  792. Sub mirrordo ()
  793.   If Not viewdelay% And frozen% And selectobjectmode% = 0 And colourinmode% = 0 And bodystatus% = 0 And picselect% = 0 Then
  794.     grabit.MousePointer = 11
  795.     Call setactivepage(4)
  796.     Call mirror(0)
  797.     Call setactivepage(3)
  798.     Call mirror(1)
  799.     scrollaround
  800.     If grabit.registerBMP.Visible Then grabit.registerBMP.SetFocus
  801.     grabit.MousePointer = 0
  802.   End If
  803. End Sub
  804.  
  805. Sub mousecheckker (x, y, button%, updown%)
  806.   
  807. Static chkx1%, chkx2%, chky1%, chky2%
  808.  
  809.   If picselect% And updown% Then
  810.     Call loadpicshow(x, y)
  811.   ElseIf bodystatus% = 1 And Not updown% Then
  812.     If button% = 1 Then
  813.       bodymovex% = (x \ 4) * 4
  814.       bodymovey% = (y \ 4) * 4
  815.       bodystatus% = 2
  816.       grabit.MousePointer = 0
  817.     End If
  818.   ElseIf bodystatus% = 2 And Not updown% Then
  819.     If button% = 1 Then
  820.       x1% = bodymovex%
  821.       x2% = (x \ 4) * 4
  822.       y1% = bodymovey%
  823.       y2% = (y \ 4) * 4
  824.       If x1% > x2% Then
  825.     xtemp% = x1%
  826.     x1% = x2%
  827.     x2% = xtemp%
  828.       End If
  829.       If y1% > y2% Then
  830.     xtemp% = y1%
  831.     y1% = y2%
  832.     y2% = xtemp%
  833.       End If
  834.       b1% = x1%
  835.       b2% = y1%
  836.       b3% = x2%
  837.       b4% = y2%
  838.       testx% = getxpos%()
  839.       testy% = getypos%()
  840.       If x1% < testx% Then x1% = testx%
  841.       If y1% < testy% Then y1% = testy%
  842.       If x2% > testx% + sizex% Then x2% = testx% + sizex%
  843.       If y2% > testy% + sizey% Then y2% = testy% + sizey%
  844.       If (x1% >= testx%) And (x1% <= testx% + sizex%) And (x2% >= testx%) And (x2% <= testx% + sizex%) And (y1% >= testy%) And (y1% <= testy% + sizey%) And (y2% >= testy%) And (y2% <= testy% + sizey%) Then
  845.     If bodymovex% <> (x \ 4) * 4 And bodymovey% <> (y \ 4) * 4 Then
  846.       chkx1% = bodymovex%
  847.       chky1% = bodymovey%
  848.       chkx2% = x
  849.       chky2% = y
  850.       If chkx1% > chkx2% Then
  851.         xtemp% = chkx1%
  852.         chkx1% = chkx2%
  853.         chkx2% = xtemp%
  854.       End If
  855.       If chky1% > chky2% Then
  856.         xtemp% = chky1%
  857.         chky1% = chky2%
  858.         chky2% = xtemp%
  859.       End If
  860.       bodymovex% = x1%
  861.       bodymovey% = y1%
  862.       bodyx2% = x2%
  863.       bodyy2% = y2%
  864.       bodystatus% = 3
  865.     End If
  866.       End If
  867.     End If
  868.   ElseIf bodystatus% = 3 And Not updown% Then
  869.     If y > bodymovey% And y < bodyy2% And x > bodymovex% And x < bodyx2% Then
  870.       'do nothing
  871.     Else
  872.       x1% = bodymovex%
  873.       x2% = bodyx2%
  874.       y1% = bodymovey%
  875.       y2% = bodyy2%
  876.       If y <= chky1% Then
  877.     bodydirection% = 1
  878.     moveorgy% = getypos() + sizey%
  879.       ElseIf y >= chky2% Then
  880.     bodydirection% = 2
  881.     moveorgy% = getypos()
  882.       ElseIf x <= chkx1% Then
  883.     bodydirection% = 3
  884.     moveorgx% = getxpos() + sizex%
  885.       ElseIf x >= chkx2% Then
  886.     bodydirection% = 4
  887.     moveorgx% = getxpos()
  888.       End If
  889.       If x < 30 Then x = 30
  890.       If x > 610 Then x = 610
  891.       If y < 30 Then y = 30
  892.       If y > 450 Then y = 450
  893.       grabit.bodyplus.Left = x - 32
  894.       grabit.bodyplus.Top = y - 32
  895.       grabit.Bodyminus.Left = x
  896.       grabit.Bodyminus.Top = y - 32
  897.       grabit.bodyok.Left = x - 32
  898.       grabit.bodyok.Top = y
  899.       grabit.bodynotok.Left = x
  900.       grabit.bodynotok.Top = y
  901.       grabit.bodyplus.Visible = True
  902.       grabit.Bodyminus.Visible = True
  903.       grabit.bodyok.Visible = True
  904.       grabit.bodynotok.Visible = True
  905.       bodystatus% = 4
  906.       Call storerle
  907.       olderx% = sizex%
  908.       oldery% = sizey%
  909.       oldmidx% = grabit.HScroll1.Value
  910.       oldmidy% = grabit.VScroll1.Value
  911.       anychange% = False
  912.       jump% = 0
  913.       bodyzoom% = 100
  914.       testx% = getxpos%()
  915.       testy% = getypos%()
  916.       bbb1% = x1% - testx%
  917.       bbb2% = y1% - testy%
  918.       bbb3% = x2% - testx%
  919.       bbb4% = y2% - testy%
  920.       widthx% = b3% - b1%
  921.       widthy% = b4% - b2%
  922.       m1% = b1%
  923.       m2% = b2%
  924.       m3% = b3%
  925.       m4% = b4%
  926.     End If
  927.   ElseIf Not updown% Then
  928.       index% = -1
  929.       If selectobjectmode% = 1 Then
  930.     y = y - 1
  931.     index% = ((x - 80) \ 132) + ((y \ 160) * 4) + 1
  932.     If index% > 12 Then index% = 12
  933.     If index% <> -1 Then
  934.       selectobjectmode% = 2
  935.       overlaycheck (index%)
  936.     End If
  937.       ElseIf colourinmode% = 1 Then
  938.     If y > 480 - col1% Then y = 479 - col1%
  939.     index% = ((x - 80) \ 140) + (((y - col1%) \ col2%) * 4) + 2
  940.     If index% > 17 Then index% = 17
  941.     If index% <> -1 Then colourmixdo (index%)
  942.       ElseIf colourinmode% = 2 Then
  943.     colourmixdo (x)
  944.       ElseIf colourinmode% = 99 Then
  945.     w02% = (((x - 80) \ 140) + (((y - col1%) \ col2%) * 4)) * 2 + 1
  946.     If colourchart(w02%, 1) < colourchart(w02% + 1, 1) Then
  947.       w12% = colourchart(w02%, 1)
  948.     Else
  949.       w12% = colourchart(w02% + 1, 1)
  950.     End If
  951.     If colourchart(w02%, 2) < colourchart(w02% + 1, 2) Then
  952.       w22% = colourchart(w02%, 2)
  953.     Else
  954.       w22% = colourchart(w02% + 1, 2)
  955.     End If
  956.     If colourchart(w02%, 3) < colourchart(w02% + 1, 3) Then
  957.       w32% = colourchart(w02%, 3)
  958.     Else
  959.       w32% = colourchart(w02% + 1, 3)
  960.     End If
  961.     r12% = Abs(colourchart(w02%, 1) - colourchart(w02% + 1, 1))
  962.     r22% = Abs(colourchart(w02%, 2) - colourchart(w02% + 1, 2))
  963.     r32% = Abs(colourchart(w02%, 3) - colourchart(w02% + 1, 3))
  964.     Call copyblock(0, 0, 640, 480, 2, 1)
  965.     q% = maskimage(selected$, getxpos%(), getypos%(), 0, 3, 1)
  966.     colourbaron% = True
  967.     Call copyblock(0, 0, 640, 480, 1, 0)
  968.     brushcolourdraw
  969.     scrollhere
  970.     colourinmode% = False
  971.     grabit.MousePointer = 0
  972.     pixelpatch% = 0
  973.     drawbar
  974.     Call resetundo
  975.     If grabit.registerBMP.Visible Then grabit.registerBMP.SetFocus
  976.       Else
  977.     linex% = 0
  978.     liney% = 0
  979.     Call mousepaint(x, y, button)
  980.       End If
  981.   End If
  982. End Sub
  983.  
  984. Sub mousecheckker2 (x, y, button%)
  985.   If printstate% Then
  986.     Call setxycursor(640, 480)
  987.     If button% <> 0 Then
  988.       Call printvideorestore
  989.     End If
  990.   End If
  991. End Sub
  992.  
  993. Sub mousepaint (x, y, button%)
  994.   
  995. Static patch%
  996. If patch% = 0 Then
  997.   If Not frozen% Then
  998.     Call target(12)
  999.   Else
  1000.     Call target(0)
  1001.   End If
  1002.   patch% = 1
  1003. End If
  1004.  
  1005. If bodystatus% = 2 Then
  1006.   grabit.Line -(bodymovex%, bodymovey%), RGB(0, 128, 0), B
  1007.   grabit.Line (bodymovex%, bodymovey%)-((x \ 4) * 4, (y \ 4) * 4), RGB(255, 0, 0), B
  1008. End If
  1009.  
  1010. If Not viewdelay% And frozen% And selectobjectmode% = 0 And colourinmode% = 0 And bodystatus% = 0 And picselect% = 0 Then
  1011.   Select Case brush%
  1012.   Case 0
  1013.     adjust% = 2
  1014.     brushcheck% = -1
  1015.   Case 1
  1016.     adjust% = 3
  1017.     brushcheck% = -2
  1018.   Case 2
  1019.     adjust% = 4
  1020.     brushcheck% = -4
  1021.   End Select
  1022.   testx% = getxpos%()
  1023.   testy% = getypos%()
  1024.   If pixelpatch% And y < 481 + brushcheck% And y > 7 + brushcheck% Then
  1025.     If x - 6 > testx% Then
  1026.       If y - 6 > testy% Then
  1027.     If x + 6 < testx% + sizex% Then
  1028.       If y + 6 < testy% + sizey% Then
  1029.         If button% = 1 Then
  1030.           If linex% <> 0 And liney% <> 0 Then
  1031.         x1% = linex%
  1032.         x2% = x - adjust%
  1033.         y1% = liney%
  1034.         y2% = y - adjust%
  1035.         If x1% <> x2% Or y1% <> y2% Then
  1036.           If y1% <> y2% And (Abs(y1% - y2%) >= Abs(x1% - x2%)) Then
  1037.             hill@ = Abs((x1% - x2%) / (y2% - y1%))
  1038.             stepper% = adjust% - 1
  1039.             If y1% > y2% Then stepper% = -stepper%
  1040.             For yer% = y1% To y2% Step stepper%
  1041.               If x2% < x1% Then
  1042.             xer% = Int(x1% - (Abs(yer% - y1%) * hill@))
  1043.               Else
  1044.             xer% = Int((Abs(yer% - y1%) * hill@) + x1%)
  1045.               End If
  1046.               Call setactivepage(0)
  1047.               Call drawcircle(xer%, yer%)
  1048.               Call setcolourtable(0)
  1049.               Call setactivepage(4)
  1050.               Call rlechange(1)
  1051.               Call drawcircle(xer% - testx%, yer% - testy%)
  1052.               Call rlechange(0)
  1053.               Call setcolourtable(1)
  1054.               Call setactivepage(3)
  1055.               Call drawcircle(xer% - testx%, yer% - testy%)
  1056.             Next yer%
  1057.           ElseIf x1% <> x2% And (Abs(y1% - y2%) <= Abs(x1% - x2%)) Then
  1058.             hill@ = Abs((y1% - y2%) / (x2% - x1%))
  1059.             stepper% = adjust% - 1
  1060.             If x1% > x2% Then stepper% = -stepper%
  1061.             For xer% = x1% To x2% Step stepper%
  1062.               If y2% < y1% Then
  1063.             yer% = Int(y1% - (Abs(xer% - x1%) * hill@))
  1064.               Else
  1065.             yer% = Int((Abs(xer% - x1%) * hill@) + y1%)
  1066.               End If
  1067.               Call setactivepage(0)
  1068.               Call drawcircle(xer%, yer%)
  1069.               Call setcolourtable(0)
  1070.               Call setactivepage(4)
  1071.               Call rlechange(1)
  1072.               Call drawcircle(xer% - testx%, yer% - testy%)
  1073.               Call rlechange(0)
  1074.               Call setcolourtable(1)
  1075.               Call setactivepage(3)
  1076.               Call drawcircle(xer% - testx%, yer% - testy%)
  1077.             Next xer%
  1078.           End If
  1079.         End If
  1080.           Else
  1081.         Call setactivepage(0)
  1082.         Call drawcircle(x - adjust%, y - adjust%)
  1083.         Call setcolourtable(0)
  1084.         Call setactivepage(4)
  1085.         Call rlechange(1)
  1086.         Call drawcircle(x - adjust% - testx%, y - adjust% - testy%)
  1087.         Call rlechange(0)
  1088.         Call setcolourtable(1)
  1089.         Call setactivepage(3)
  1090.         Call drawcircle(x - adjust% - testx%, y - adjust% - testy%)
  1091.         Call toggleiconsalloff
  1092.           End If
  1093.           linex% = x - adjust%
  1094.           liney% = y - adjust%
  1095. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  1096.         ElseIf button = 2 Then
  1097.           If linex% <> 0 And liney% <> 0 Then
  1098.         x1% = linex%
  1099.         x2% = x - adjust%
  1100.         y1% = liney%
  1101.         y2% = y - adjust%
  1102.         If x1% <> x2% Or y1% <> y2% Then
  1103.           If y1% <> y2% And (Abs(y1% - y2%) >= Abs(x1% - x2%)) Then
  1104.             hill@ = Abs((x1% - x2%) / (y2% - y1%))
  1105.             stepper% = adjust% - 1
  1106.             If y1% > y2% Then stepper% = -stepper%
  1107.             For yer% = y1% To y2% Step stepper%
  1108.               If x2% < x1% Then
  1109.             xer% = Int(x1% - (Abs(yer% - y1%) * hill@))
  1110.               Else
  1111.             xer% = Int((Abs(yer% - y1%) * hill@) + x1%)
  1112.               End If
  1113.               Call setactivepage(4)
  1114.               Call rlechange(1)
  1115.               Call clearcircle(xer% - testx%, yer% - testy%)
  1116.               Call rlechange(0)
  1117.               Call setactivepage(3)
  1118.               Call clearcircle(xer% - testx%, yer% - testy%)
  1119.               Call copycircle(xer%, yer%, 2, 0)
  1120.             Next yer%
  1121.           ElseIf x1% <> x2% And (Abs(y1% - y2%) <= Abs(x1% - x2%)) Then
  1122.             hill@ = Abs((y1% - y2%) / (x2% - x1%))
  1123.             stepper% = adjust% - 1
  1124.             If x1% > x2% Then stepper% = -stepper%
  1125.             For xer% = x1% To x2% Step stepper%
  1126.               If y2% < y1% Then
  1127.             yer% = Int(y1% - (Abs(xer% - x1%) * hill@))
  1128.               Else
  1129.             yer% = Int((Abs(xer% - x1%) * hill@) + y1%)
  1130.               End If
  1131.               Call setactivepage(4)
  1132.               Call rlechange(1)
  1133.               Call clearcircle(xer% - testx%, yer% - testy%)
  1134.               Call rlechange(0)
  1135.               Call setactivepage(3)
  1136.               Call clearcircle(xer% - testx%, yer% - testy%)
  1137.               Call copycircle(xer%, yer%, 2, 0)
  1138.             Next xer%
  1139.           End If
  1140.         End If
  1141.           Else
  1142.         Call setactivepage(4)
  1143.         Call rlechange(1)
  1144.         Call clearcircle(x - adjust% - testx%, y - adjust% - testy%)
  1145.         Call rlechange(0)
  1146.         Call setactivepage(3)
  1147.         Call clearcircle(x - adjust% - testx%, y - adjust% - testy%)
  1148.         Call copycircle(x - adjust%, y - adjust%, 2, 0)
  1149.         Call toggleiconsalloff
  1150.           End If
  1151.           linex% = x - adjust%
  1152.           liney% = y - adjust%
  1153.         End If
  1154.       Else
  1155.         linex% = 0
  1156.         liney% = 0
  1157.       End If
  1158.     Else
  1159.       linex% = 0
  1160.       liney% = 0
  1161.     End If
  1162.       Else
  1163.     linex% = 0
  1164.     liney% = 0
  1165.       End If
  1166.     Else
  1167.       linex% = 0
  1168.       liney% = 0
  1169.     End If
  1170.   End If
  1171.   pixelpatch% = -1
  1172. End If
  1173. End Sub
  1174.  
  1175. Sub movieact (x, y)
  1176.   If zoomstep% < 4 Then
  1177.     stepper% = 4
  1178.   ElseIf zoomstep% < 7 Then
  1179.     stepper% = 8
  1180.   Else
  1181.     stepper% = 12
  1182.   End If
  1183.   If Not viewdelay% And frozen% And selectobjectmode% = 0 And colourinmode% = 0 And bodystatus% = 0 And picselect% = 0 Then
  1184.     Call toggleiconsalloff
  1185.     Do
  1186.       If x < 40 And 40 - y > x Then
  1187.     Exit Sub
  1188.       ElseIf x > 40 And y < x - 40 Then
  1189.     Exit Sub
  1190.       ElseIf x < 40 And y - 40 > x Then
  1191.     Exit Sub
  1192.       ElseIf x > 40 And x - 40 > 80 - y Then
  1193.     Exit Sub
  1194.       End If
  1195.       If x > y Then
  1196.     If x > 80 - y Then
  1197.       grabit.HScroll1.Value = grabit.HScroll1.Value + stepper%
  1198.     Else
  1199.       If grabit.VScroll1.Value - stepper% >= grabit.VScroll1.Min Then
  1200.         grabit.VScroll1.Value = grabit.VScroll1.Value - stepper%
  1201.       End If
  1202.     End If
  1203.       Else
  1204.     If x > 80 - y Then
  1205.       If grabit.VScroll1.Value + stepper% <= grabit.VScroll1.Max Then
  1206.         grabit.VScroll1.Value = grabit.VScroll1.Value + stepper%
  1207.       End If
  1208.     Else
  1209.       grabit.HScroll1.Value = grabit.HScroll1.Value - stepper%
  1210.     End If
  1211.       End If
  1212.     Loop Until getinputstate() <> 0
  1213.   End If
  1214. End Sub
  1215.  
  1216. Sub noicons ()
  1217.   Call toggleiconsalloff
  1218.   grabit.Command1.Visible = False
  1219.   grabit.Command2.Visible = False
  1220.   grabit.Command3.Visible = False
  1221.   grabit.Commandzoom.Visible = False
  1222.   grabit.choicesbutton.Visible = False
  1223.   grabit.Undobutton.Visible = False
  1224.   grabit.Picture1.Visible = False
  1225.   grabit.Picture2.Visible = False
  1226.   grabit.Picture3.Visible = False
  1227.   grabit.Picture4.Visible = False
  1228.   grabit.Picture5.Visible = False
  1229.   grabit.Picture6.Visible = False
  1230.   grabit.Picture7.Visible = False
  1231.   grabit.Picture8.Visible = False
  1232.   grabit.movie.Visible = False
  1233.   grabit.grabitQUIT.Visible = False
  1234.   grabit.registerBMP.Visible = False
  1235.   grabit.Refresh
  1236. End Sub
  1237.  
  1238. Sub noiconsreturn ()
  1239.   grabit.Command1.Visible = True
  1240.   grabit.Command2.Visible = True
  1241.   grabit.Command3.Visible = True
  1242.   grabit.Commandzoom.Visible = True
  1243.   grabit.choicesbutton.Visible = True
  1244.   grabit.Undobutton.Visible = True
  1245.   grabit.Picture1.Visible = True
  1246.   grabit.Picture2.Visible = True
  1247.   grabit.Picture3.Visible = True
  1248.   grabit.Picture4.Visible = True
  1249.   grabit.Picture5.Visible = True
  1250.   grabit.Picture6.Visible = True
  1251.   grabit.Picture7.Visible = True
  1252.   grabit.movie.Visible = True
  1253.   grabit.grabitQUIT.Visible = True
  1254.   grabit.registerBMP.Visible = True
  1255.   grabit.Refresh
  1256. End Sub
  1257.  
  1258. Sub overlay ()
  1259.   If Not viewdelay% And colourinmode% = False And selectobjectmode% = False And picselect% = 0 And bodystatus% = 0 Then
  1260.     If Not frozen% Then freezetoggle
  1261.     grabit.MousePointer = 11
  1262.     scrollgone (2)
  1263.     q% = pcv_clearvideorect(0, 0, 641, 480)
  1264.     selectobjectmode% = 1
  1265.     For x% = 1 To 12
  1266.       objects$(x%) = "obj" + Right$("0" + LTrim$(Str$(x%)), 2) + "-2.mmp"
  1267.     Next x%
  1268.     y% = 1
  1269.     Call setactivepage(1)
  1270.     Call clearpage(1)
  1271.     For dumm% = 0 To 2
  1272.       For x% = 80 To 476 Step 132
  1273.     Open Left$(objects$(y%), 5) + ".rgb" For Input As #1
  1274.     Line Input #1, tr$
  1275.     Line Input #1, tg$
  1276.     Line Input #1, tb$
  1277.     Close 1
  1278.     newr% = 100 + (penred% - Val(tr$)) / Val(tr$) * 100
  1279.     newg% = 100 + (pengreen% - Val(tg$)) / Val(tg$) * 100
  1280.     newb% = 100 + (penblue% - Val(tb$)) / Val(tb$) * 100
  1281.     If greystate% Then
  1282.       q% = greymiximage(Left$(objects$(y%), InStr(objects$(y%), ".") - 1), x%, dumm% * 160, 1, 1, Val(tr$), Val(tg$), Val(tb$), newr%, newg%, newb%)
  1283.     Else
  1284.       q% = colmiximage(Left$(objects$(y%), InStr(objects$(y%), ".") - 1), x%, dumm% * 160, 1, 1, Val(tr$), Val(tg$), Val(tb$), newr%, newg%, newb%)
  1285.     End If
  1286.     y% = y% + 1
  1287.       Next x%
  1288.     Next dumm%
  1289.     Call copyblock(0, 0, 640, 480, 1, 0)
  1290.     grabit.MousePointer = 0
  1291.   End If
  1292. End Sub
  1293.  
  1294. Sub overlaycheck (object%)
  1295.   If selectobjectmode% = 2 Then
  1296.     grabit.MousePointer = 11
  1297.     If penred% = selectedred% And pengreen% = selectedgreen% And penblue% = selectedblue% Then
  1298.       penred% = 0
  1299.       pengreen% = 0
  1300.       penblue% = 0
  1301.     End If
  1302.     selected$ = Left$(objects$(object%), 5)
  1303.     If Not greystate% Then
  1304.       Open selected$ + ".rgb" For Input As #1
  1305.       Input #1, selectedred%
  1306.       Input #1, selectedgreen%
  1307.       Input #1, selectedblue%
  1308.       Input #1, tempwidth$
  1309.       Input #1, temphight$
  1310.       Close
  1311.     End If
  1312.     If penred% = 0 And pengreen% = 0 And penblue% = 0 Then
  1313.       penred% = selectedred%
  1314.       pengreen% = selectedgreen%
  1315.       penblue% = selectedblue%
  1316.     End If
  1317.  
  1318.     Open selected$ + ".mmp" For Binary As #1
  1319.     dum$ = "  "
  1320.     Get #1, 13, dum$
  1321.     sizex% = (Asc(Right$(dum$, 1)) * 256 + Asc(Left$(dum$, 1)))
  1322.     Get #1, 15, dum$
  1323.     sizey% = (Asc(Right$(dum$, 1)) * 256 + Asc(Left$(dum$, 1)))
  1324.     Close
  1325.  
  1326.     grabit.Picture1.FillColor = RGB(penred%, pengreen%, penblue%)
  1327.     brushcolourdraw
  1328.     coltest% = picloaded%
  1329.     picloaded% = True
  1330.     
  1331.     change% = 100
  1332.     If coltest% = 0 Then
  1333.       grabit.HScroll1.Value = 319
  1334.       grabit.VScroll1.Value = 239
  1335.     End If
  1336.     z1% = 12345
  1337.     If zoomx% = 0 Then
  1338.       Call zoom(change%, -1, 0)
  1339.     Else
  1340.       Call zoom(-4, -1, 0)
  1341.     End If
  1342.     selectobjectmode% = False
  1343.     grabit.MousePointer = 0
  1344.     If coltest% = 0 Then
  1345.       Call colourmix(1)
  1346.       coltest% = 1
  1347.     Else
  1348.       scrollhere
  1349.     End If
  1350.     oldx% = getxpos%()
  1351.     oldy% = getypos%()
  1352.     pixelpatch% = 0
  1353.     Call initvariance(15)
  1354.     drawbar
  1355.     Call resetundo
  1356.   End If
  1357. End Sub
  1358.  
  1359. Sub printvideo ()
  1360.   If Not viewdelay% And frozen% And selectobjectmode% = False And picloaded% And colourinmode% = False And bodystatus% = 0 Then
  1361.     Call setxycursor(640, 480)
  1362.     Call noicons
  1363.     printstate% = True
  1364.   End If
  1365. End Sub
  1366.  
  1367. Sub printvideorestore ()
  1368.   Call noiconsreturn
  1369.   If logo% Then
  1370.     q% = loadmmp("temp.mmp", 0, 0)
  1371.   End If
  1372.   If key0% Then
  1373.     Call zoom(-4, 0, 0)
  1374.     key0% = False
  1375.   End If
  1376.   Call enablemouse
  1377.   If picselect% Then
  1378.     Call setxycursor(101, 352)
  1379.   ElseIf logo% = -1 Then
  1380.     Call setxycursor(101, 56)
  1381.   Else
  1382.     Call setxycursor(150, 316)
  1383.   End If
  1384.   If grabit.registerBMP.Visible Then grabit.registerBMP.SetFocus
  1385.   logo% = 0
  1386.   picselect% = 0
  1387.   printstate% = 0
  1388. End Sub
  1389.  
  1390. Function round% (q!)
  1391.   If q! - Int(q!) >= .5 Then
  1392.     round% = Int(q!) + 1
  1393.   Else
  1394.     round% = Int(q!)
  1395.   End If
  1396. End Function
  1397.  
  1398. Sub scrollaround ()
  1399.   If Not viewdelay% And frozen% And Not colourinmode% And selectobjectmode% = 0 And Not xpos% And picloaded% And picselect% = 0 And bodystatus% = 0 Then
  1400.     x% = getxpos%()
  1401.     y% = getypos%()
  1402.     If oldx% = 0 And oldy% = 0 Then
  1403.       Call copyblock(0, 0, 640, 480, 2, 1)
  1404.     Else
  1405.       If x% <> oldx% Then
  1406.     If x% > oldx% Then
  1407.       Call copyblock(oldx%, y%, sizex% + x% - oldx%, sizey%, 2, 1)
  1408.     Else
  1409.       Call copyblock(x%, y%, sizex% + oldx% - x%, sizey%, 2, 1)
  1410.     End If
  1411.       Else
  1412.     If y% > oldy% Then
  1413.       Call copyblock(x%, oldy%, sizex%, sizey% + y% - oldy%, 2, 1)
  1414.     Else
  1415.       Call copyblock(x%, y%, sizex%, sizey% + oldy% - y%, 2, 1)
  1416.     End If
  1417.       End If
  1418.     End If
  1419.     q% = maskimage(selected$, x%, y%, 0, 3, 1)
  1420.     
  1421.     If oldx% = 0 And oldy% = 0 Then
  1422.       Call copyblock(0, 0, 640, 480, 1, 0)
  1423.     Else
  1424.       If x% <> oldx% Then
  1425.     If x% > oldx% Then
  1426.       Call copyblock(oldx%, y%, sizex% + x% - oldx%, sizey%, 1, 0)
  1427.     Else
  1428.       Call copyblock(x%, y%, sizex% + oldx% - x%, sizey%, 1, 0)
  1429.     End If
  1430.       Else
  1431.     If y% > oldy% Then
  1432.       Call copyblock(x%, oldy%, sizex%, sizey% + y% - oldy%, 1, 0)
  1433.     Else
  1434.       Call copyblock(x%, y%, sizex%, sizey% + oldy% - y%, 1, 0)
  1435.     End If
  1436.       End If
  1437.     End If
  1438.     oldx% = x%
  1439.     oldy% = y%
  1440.     Call resetundo
  1441.     If grabit.registerBMP.Visible Then grabit.registerBMP.SetFocus
  1442.   End If
  1443. End Sub
  1444.  
  1445. Sub scrollgone (yeah%)
  1446.   grabit.movie.Visible = False
  1447.   grabit.Picture1.Visible = False
  1448.   If yeah% = 2 Then grabit.registerBMP.Visible = False
  1449. End Sub
  1450.  
  1451. Sub scrollhere ()
  1452.   grabit.movie.Visible = True
  1453.   grabit.Picture1.Visible = True
  1454.   grabit.registerBMP.Visible = True
  1455. End Sub
  1456.  
  1457. Sub setupcolourbarindicators (ppp1%, ppp2%)
  1458.   If (((ppp1% - 124) / 480) * 100) + 74 < 80 Then
  1459.     grabit.colpos1.Left = 80
  1460.   ElseIf (((ppp1% - 124) / 480) * 100) + 74 > 167 Then
  1461.     grabit.colpos1.Left = 167
  1462.   Else
  1463.     grabit.colpos1.Left = (((ppp1% - 124) / 480) * 100) + 74
  1464.   End If
  1465.   If (((ppp2% - 124) / 480) * 100) + 74 < 80 Then
  1466.     grabit.colpos2.Left = 80
  1467.   ElseIf (((ppp2% - 124) / 480) * 100) + 74 > 167 Then
  1468.     grabit.colpos2.Left = 167
  1469.   Else
  1470.     grabit.colpos2.Left = (((ppp2% - 124) / 480) * 100) + 74
  1471.   End If
  1472. End Sub
  1473.  
  1474. Sub showlogo (from%)
  1475.   If Not viewdelay% And frozen% And selectobjectmode% = False And picloaded% And colourinmode% = False And picselect% = 0 And bodystatus% = 0 Then
  1476.     Call setactivepage(0)
  1477.     logo% = -from%
  1478.     q% = savemmp("temp.mmp", 0, 0, 640, 480)
  1479.     Call printvideo
  1480.     q% = loadmmp("logo.mmp", 0, 0)
  1481.   End If
  1482. End Sub
  1483.  
  1484. Sub sinkin ()
  1485.   If Not viewdelay% And frozen% And selectobjectmode% = 0 And colourinmode% = 0 And bodystatus% = 0 And picselect% = 0 Then
  1486.     q% = maskimage(selected$, getxpos%(), getypos%(), 0, 3, 2)
  1487.   End If
  1488. End Sub
  1489.  
  1490. Sub slideshow ()
  1491.   q% = MsgBox("Start the Slide Show Demonstation ?", 1, "Slideshow Demonstation")
  1492.   If q% = 1 Then
  1493.     Call noicons
  1494.     Call setactivepage(0)
  1495.     freeze
  1496.     Call clearpage(0)
  1497.     target (0)
  1498.     Call resetundo
  1499.     grabit.Slideshowexit.Visible = True
  1500.     grabit.democaption.Visible = True
  1501.     grabit.slideshowtimer.Enabled = True
  1502.     Call setxycursor(613, 460)
  1503.     Call slideshowshow
  1504.   End If
  1505. End Sub
  1506.  
  1507. Sub slideshowend ()
  1508.     grabit.democaption.Visible = False
  1509.     grabit.Slideshowexit.Visible = False
  1510.     grabit.slideshowtimer.Enabled = False
  1511.     Call clearpage(0)
  1512.     unfreeze
  1513.     colourinmode% = False
  1514.     selectobjectmode% = False
  1515.     picselect% = False
  1516.     target (12)
  1517.     Call noiconsreturn
  1518.     delayslide% = 0
  1519.     slide% = 0
  1520. End Sub
  1521.  
  1522. Sub slideshowshow ()
  1523. Static forward%
  1524.   If delayslide% >= (Val(slidetext$(currentslide%, 2)) * 4) Or delayslide% = 0 Then
  1525.     currentslide% = currentslide% + 1
  1526.     If currentslide% > slidestext% Then currentslide% = 1
  1527.     grabit.democaption.Visible = False
  1528.     grabit.democaption.FontSize = slidetext$(currentslide%, 4)
  1529.     grabit.democaption.Caption = slidetext$(currentslide%, 3)
  1530.     grabit.democaption.ForeColor = RGB(Val(slidetext$(currentslide%, 5)), Val(slidetext$(currentslide%, 6)), Val(slidetext$(currentslide%, 7)))
  1531.     grabit.democaption.Visible = True
  1532.     Call setactivepage(1)
  1533.     If slidetext$(currentslide%, 1) <> "NONE" And Dir$(slidetext$(currentslide%, 1) + ".mmp") <> "" Then
  1534.       q% = loadmmp(slidetext$(currentslide%, 1) + ".mmp", 0, 0)
  1535.       If forward% Then
  1536.     For xyz% = 1 To 4800
  1537.       Call copyblock(area%(xyz%, 1), area%(xyz%, 2), 8, 8, 1, 0)
  1538.     Next xyz%
  1539.       Else
  1540.     For xyz% = 4800 To 1 Step -1
  1541.       Call copyblock(area%(xyz%, 1), area%(xyz%, 2), 8, 8, 1, 0)
  1542.     Next xyz%
  1543.       End If
  1544.       forward% = forward% Xor 1
  1545.     Else
  1546.       Call clearpage(1)
  1547.       For xyz% = 1 To 4800
  1548.     Call copyblock(area%(xyz%, 1), area%(xyz%, 2), 8, 8, 1, 0)
  1549.       Next xyz%
  1550.     End If
  1551.     delayslide% = 1
  1552.   End If
  1553.   If slidetext$(currentslide%, 8) = "Y" And (delayslide% Mod 4 = 0) Then
  1554.     grabit.democaption.ForeColor = RGB(0, 128, 0)
  1555.   Else
  1556.     grabit.democaption.ForeColor = RGB(Val(slidetext$(currentslide%, 5)), Val(slidetext$(currentslide%, 6)), Val(slidetext$(currentslide%, 7)))
  1557.   End If
  1558.   delayslide% = delayslide% + 1
  1559. End Sub
  1560.  
  1561. Sub storepic ()
  1562.   If Not viewdelay% And frozen% And selectobjectmode% = False And picloaded% And colourinmode% = False And picselect% = 0 And bodystatus% = 0 Then
  1563.     grabit.MousePointer = 11
  1564.     Call setactivepage(0)
  1565.     q% = savemmp("store" + LTrim$(RTrim$(Str$(lastpicsaved%))) + ".mmp", 0, 0, 640, 480)
  1566.     lastpicsaved% = lastpicsaved% + 1
  1567.     If lastpicsaved% = 4 Then lastpicsaved% = 0
  1568.     grabit.MousePointer = 0
  1569.     If grabit.registerBMP.Visible Then grabit.registerBMP.SetFocus
  1570.   End If
  1571. End Sub
  1572.  
  1573. Sub target (col%)
  1574.  If col% = 12 Then
  1575.     grabit.Line (240, 2)-(240, 478), RGB(255, 0, 0)
  1576.     grabit.Line (410, 2)-(410, 478), RGB(255, 0, 0)
  1577.     grabit.Line (2, 260)-(638, 260), RGB(255, 0, 0)
  1578.   Else
  1579.     grabit.Line (240, 2)-(240, 478), RGB(0, 128, 0)
  1580.     grabit.Line (410, 2)-(410, 478), RGB(0, 128, 0)
  1581.     grabit.Line (2, 260)-(638, 260), RGB(0, 128, 0)
  1582.   End If
  1583. End Sub
  1584.  
  1585. Sub toggleicon1 ()
  1586.   If onoff% = False Then
  1587.     onoff% = True
  1588.   Else
  1589.     onoff% = False
  1590.   End If
  1591.   grabit.freeze.Visible = onoff%
  1592.   grabit.Picture8.Visible = onoff%
  1593.   grabit.Before.Visible = onoff%
  1594.   grabit.Picture9.Visible = onoff%
  1595.   grabit.Front.Visible = onoff%
  1596.   grabit.Picture10.Visible = onoff%
  1597.   grabit.Profile.Visible = onoff%
  1598.   grabit.Picture11.Visible = onoff%
  1599. End Sub
  1600.  
  1601. Sub toggleicon3 ()
  1602.   If onoff3% = False Then
  1603.     onoff3% = True
  1604.   Else
  1605.     onoff3% = False
  1606.   End If
  1607.   grabit.colourhair.Visible = onoff3%
  1608.   grabit.Picture12.Visible = onoff3%
  1609.   grabit.colourbrush.Visible = onoff3%
  1610.   grabit.Picture13.Visible = onoff3%
  1611.   grabit.greyscale.Visible = onoff3%
  1612.   grabit.Picture14.Visible = onoff3%
  1613.  
  1614.   If onoff3% And colourbaron% Then
  1615.     ttt1% = grabit.HScroll5.Value
  1616.     ttt2% = grabit.HScroll6.Value
  1617.     Call setupcolourbarindicators(ttt1%, ttt2%)
  1618.     grabit.chart.Visible = True
  1619.     grabit.colpos1.Visible = True
  1620.     grabit.colpos2.Visible = True
  1621.     Call colourbarnew(0)
  1622.   End If
  1623.  
  1624.   If Not onoff3% And colourbaron% Then
  1625.     grabit.chart.Visible = False
  1626.     grabit.colpos1.Visible = False
  1627.     grabit.colpos2.Visible = False
  1628.     Call copyblock(76, 225, 96, 70, 2, 1)
  1629.     q% = maskimage(selected$, getxpos%(), getypos%(), 0, 3, 1)
  1630.     Call copyblock(76, 225, 96, 70, 1, 0)
  1631.   End If
  1632. End Sub
  1633.  
  1634. Sub toggleicon4 ()
  1635.   If onoff4% = False Then
  1636.     onoff4% = True
  1637.   Else
  1638.     onoff4% = False
  1639.   End If
  1640.   grabit.Picturezoom.Visible = onoff4%
  1641.   grabit.picturezoombutton.Visible = onoff4%
  1642.   grabit.bodybutton.Visible = onoff4%
  1643.   grabit.Picture15.Visible = onoff4%
  1644.   grabit.mirrorbutton.Visible = onoff4%
  1645.   grabit.Picture16.Visible = onoff4%
  1646.   grabit.stepsize.Visible = onoff4%
  1647.   grabit.combine.Visible = onoff4%
  1648.   grabit.Picture21.Visible = onoff4%
  1649. End Sub
  1650.  
  1651. Sub toggleicon5 ()
  1652.   If onoff5% = False Then
  1653.     onoff5% = True
  1654.   Else
  1655.     onoff5% = False
  1656.   End If
  1657.   grabit.storebutton.Visible = onoff5%
  1658.   grabit.Picture17.Visible = onoff5%
  1659.   grabit.loadbutton.Visible = onoff5%
  1660.   grabit.Picture18.Visible = onoff5%
  1661.   grabit.Printcommand.Visible = onoff5%
  1662.   grabit.Picture19.Visible = onoff5%
  1663.   grabit.spare.Visible = onoff5%
  1664.   grabit.Picture20.Visible = onoff5%
  1665. End Sub
  1666.  
  1667. Sub toggleicons (index%)
  1668.   'off
  1669.   If onoff% = True Then
  1670.     If index% = 1 Then
  1671.       Call toggleicon1
  1672.       Exit Sub
  1673.     Else
  1674.       Call toggleicon1
  1675.     End If
  1676.   End If
  1677.   If onoff3% = True Then
  1678.     If index% = 3 Then
  1679.       Call toggleicon3
  1680.       Exit Sub
  1681.     Else
  1682.       Call toggleicon3
  1683.     End If
  1684.   End If
  1685.   If onoff4% = True Then
  1686.     If index% = 4 Then
  1687.       Call toggleicon4
  1688.       Exit Sub
  1689.     Else
  1690.       Call toggleicon4
  1691.     End If
  1692.   End If
  1693.   If onoff5% = True Then
  1694.     If index% = 5 Then
  1695.       Call toggleicon5
  1696.       Exit Sub
  1697.     Else
  1698.       Call toggleicon5
  1699.     End If
  1700.   End If
  1701.   'on
  1702.   If index% = 1 And onoff% = False Then
  1703.     Call toggleicon1
  1704.   End If
  1705.   If index% = 3 And onoff3% = False Then
  1706.     Call toggleicon3
  1707.   End If
  1708.   If index% = 4 And onoff4% = False Then
  1709.     Call toggleicon4
  1710.   End If
  1711.   If index% = 5 And onoff5% = False Then
  1712.     Call toggleicon5
  1713.   End If
  1714.   If grabit.registerBMP.Visible Then grabit.registerBMP.SetFocus
  1715. End Sub
  1716.  
  1717. Sub toggleiconsalloff ()
  1718.   If onoff% Then toggleicon1
  1719.   If onoff3% Then toggleicon3
  1720.   If onoff4% Then toggleicon4
  1721.   If onoff5% Then toggleicon5
  1722. End Sub
  1723.  
  1724. Sub undo ()
  1725.   If Not viewdelay% And frozen% And selectobjectmode% = False And picloaded% And colourinmode% = False And picselect% = 0 And bodystatus% = 0 Then
  1726.     grabit.undotimer.Enabled = True
  1727.     Call undocircle
  1728.     Call undocircle
  1729.     Call undocircle
  1730.     Call undocircle
  1731.     Call undocircle
  1732.     Call undocircle
  1733.   End If
  1734. End Sub
  1735.  
  1736. Sub undoall ()
  1737.   If Not viewdelay% And frozen% And selectobjectmode% = False And picloaded% And colourinmode% = False And picselect% = 0 And bodystatus% = 0 Then
  1738.     Call toggleiconsalloff
  1739.     grabit.MousePointer = 11
  1740.     Call zoom(-4, 0, 0)
  1741.     grabit.MousePointer = 0
  1742.   End If
  1743. End Sub
  1744.  
  1745. Sub undoend ()
  1746.   grabit.undotimer.Enabled = False
  1747. End Sub
  1748.  
  1749. Sub unfreeze ()
  1750.   q% = pcv_unfreezevideo()
  1751.   frozen% = 0
  1752.   picloaded% = 0
  1753.   greystate% = False
  1754. End Sub
  1755.  
  1756. Sub viewend ()
  1757.   q% = pcv_unfreezevideo()
  1758.   viewdelay% = False
  1759.   grabit.freezetimer.Enabled = False
  1760.   If grabit.registerBMP.Visible Then grabit.registerBMP.SetFocus
  1761.   grabit.MousePointer = 0
  1762. End Sub
  1763.  
  1764. Sub views (side%)
  1765.   If selectobjectmode% = 0 And colourinmode% = 0 And bodystatus% = 0 And picselect% = 0 Then
  1766.     grabit.MousePointer = 11
  1767.     Call setactivepage(0)
  1768.     If Not frozen% Then   'store
  1769.       grabit.freezetimer.Enabled = True
  1770.       q% = pcv_freezevideo()
  1771.       viewdelay% = True
  1772.       If side% = 0 Then
  1773.     q% = savemmp("before.mmp", 0, 0, 640, 480)
  1774.       ElseIf side% = 1 Then
  1775.     q% = savemmp("front.mmp", 0, 0, 640, 480)
  1776.       ElseIf side% = 2 Then
  1777.     q% = savemmp("profile.mmp", 0, 0, 640, 480)
  1778.       End If
  1779.     Else                    'load
  1780.       If side% = 0 Then
  1781.     q% = loadmmp("before.mmp", 0, 0)
  1782.       ElseIf side% = 1 Then
  1783.     q% = loadmmp("front.mmp", 0, 0)
  1784.       Else
  1785.     q% = loadmmp("profile.mmp", 0, 0)
  1786.       End If
  1787.       Call copyblock(0, 0, 640, 480, 0, 2)
  1788.       scrollaround
  1789.       If grabit.registerBMP.Visible Then grabit.registerBMP.SetFocus
  1790.       grabit.MousePointer = 0
  1791.     End If
  1792.   End If
  1793. End Sub
  1794.  
  1795. Sub zoom (updown%, special%, both%)
  1796.   If Not viewdelay% And frozen% And (selectobjectmode% = False Or special%) And picloaded% And colourinmode% = False And picselect% = 0 And bodystatus% = 0 Then
  1797.     If updown% < 0 Then
  1798.       If updown% = -1 Then
  1799.     If both% = 0 Then
  1800.       zoomx% = 100
  1801.       zoomy% = 100
  1802.     ElseIf both% = 1 Then
  1803.       zoomx% = 100
  1804.     ElseIf both% = 2 Then
  1805.       zoomy% = 100
  1806.     End If
  1807.       ElseIf updown% = -2 Then
  1808.     If both% = 0 Then
  1809.       zoomx% = zoomx% - zoomstep%
  1810.       zoomy% = zoomy% - zoomstep%
  1811.     ElseIf both% = 1 Then
  1812.       zoomx% = zoomx% - zoomstep%
  1813.     ElseIf both% = 2 Then
  1814.       zoomy% = zoomy% - zoomstep%
  1815.     End If
  1816.       ElseIf updown% = -3 Then
  1817.     If both% = 0 Then
  1818.       zoomx% = zoomx% + zoomstep%
  1819.       zoomy% = zoomy% + zoomstep%
  1820.     ElseIf both% = 1 Then
  1821.       zoomx% = zoomx% + zoomstep%
  1822.     ElseIf both% = 2 Then
  1823.       zoomy% = zoomy% + zoomstep%
  1824.     End If
  1825.       End If
  1826.     Else
  1827.       zoomx% = updown%
  1828.       zoomy% = updown%
  1829.     End If
  1830.     
  1831.     If zoomx% < 65 Then zoomx% = 65
  1832.     If zoomx% > 135 Then zoomx% = 135
  1833.     If zoomy% < 65 Then zoomy% = 65
  1834.     If zoomy% > 135 Then zoomy% = 135
  1835.  
  1836.     q% = maskimage(selected$, x%, y%, 1, 3, 3)
  1837.     Open selected$ + ".mmp" For Binary As #1
  1838.     dum$ = "  "
  1839.     Get #1, 13, dum$
  1840.     sizex% = (Asc(Right$(dum$, 1)) * 256 + Asc(Left$(dum$, 1)))
  1841.     Get #1, 15, dum$
  1842.     sizey% = (Asc(Right$(dum$, 1)) * 256 + Asc(Left$(dum$, 1)))
  1843.     Close
  1844.     setactivepage (3)
  1845.     
  1846.     If zoomx% <> 100 Then sizex% = xzoomimage(zoomx%)
  1847.     If zoomy% <> 100 Then sizey% = yzoomimage(zoomy%)
  1848.     
  1849.     Call copyblock(0, 0, 640, 480, 2, 1)
  1850.     Call copyblock(0, 0, sizex%, sizey%, 3, 4)
  1851.     If coltest% <> 0 Then
  1852.       newr% = 100 + (penred% - selectedred%) / selectedred% * 100
  1853.       newg% = 100 + (pengreen% - selectedgreen%) / selectedgreen% * 100
  1854.       newb% = 100 + (penblue% - selectedblue%) / selectedblue% * 100
  1855.       If greystate% Then
  1856.     If z1% <> 12345 Then
  1857.       Call colourchange(z1%, z2%, z3%, z4%, z5%, z6%)
  1858.     End If
  1859.     Call greyscale
  1860.     Call copyblock(0, 0, sizex%, sizey%, 3, 4)
  1861.       ElseIf newr% <> 100 Or newg% <> 100 Or newb% <> 100 Then
  1862.     Call colourchange(selectedred%, selectedgreen%, selectedblue%, newr%, newg%, newb%)
  1863.       End If
  1864.       q% = maskimage(selected$, getxpos%(), getypos%(), 0, 3, 1)
  1865.       Call copyblock(0, 0, 640, 480, 1, 0)
  1866.     End If
  1867.     oldx% = 0
  1868.     oldy% = 0
  1869.     Call resetundo
  1870.     drawbar
  1871.   End If
  1872.   If grabit.registerBMP.Visible Then grabit.registerBMP.SetFocus
  1873. End Sub
  1874.  
  1875. Sub zoomit (x, y)
  1876.   If Not viewdelay% And frozen% And selectobjectmode% = 0 And picloaded% And colourinmode% = 0 And picselect% = 0 And bodystatus% = 0 Then
  1877.     grabit.MousePointer = 11
  1878.     If x < 31 Then
  1879.       If y < 31 Then
  1880.     If x > y Then
  1881.       Call zoom(-3, 0, 2)  'y +
  1882.     Else
  1883.       Call zoom(-2, 0, 1)  'x -
  1884.     End If
  1885.       Else
  1886.     If x > 62 - y Then
  1887.       Call zoom(-2, 0, 2)  'y -
  1888.     Else
  1889.       Call zoom(-2, 0, 1)  'x -
  1890.     End If
  1891.       End If
  1892.     Else
  1893.       If y < 31 Then
  1894.     If x > 62 - y Then
  1895.       Call zoom(-3, 0, 1)  'x +
  1896.     Else
  1897.       Call zoom(-3, 0, 2)  'y +
  1898.     End If
  1899.       Else
  1900.     If x - 31 < y - 31 Then
  1901.       Call zoom(-2, 0, 2)  'y -
  1902.     Else
  1903.       Call zoom(-3, 0, 1)  'x +
  1904.     End If
  1905.       End If
  1906.     End If
  1907.     grabit.MousePointer = 0
  1908.   End If
  1909. End Sub
  1910.  
  1911.